package pl.ydp.nexl.impl.net
{
	import flash.events.ErrorEvent;
	import flash.events.Event;
	
	import flexunit.framework.TestCase;

	public class TestNexlNetRegistry extends TestCase
	{
		public function TestNexlNetRegistry(methodName:String=null) {
			super(methodName);
		}
		
		public function testLoadComplete():void {
			var reg:TestableNexlNetRegistry = new TestableNexlNetRegistry();
			
			var errorReceived:Boolean = false;
			reg.addEventListener( 
				ErrorEvent.ERROR, 
				function( e:Event ):void {
					errorReceived = true;
				}
			);
			var dispatcher:EventCompleteDispatcher = new EventCompleteDispatcher();
			dispatcher.data = "<wiosna></lato>";
			dispatcher.addEventListener( Event.COMPLETE, reg.forwardLoadComplete );
			dispatcher.dispatchEvent( new Event(Event.COMPLETE) );
			assertTrue( "ErrorEvent not dispatched in case xml parse failure", errorReceived );
			
		}
	}
}
import flash.events.EventDispatcher;
	

dynamic class EventCompleteDispatcher extends EventDispatcher {
	
}